package com.wcgksoft.controller.updatePassWord;

import com.wcgksoft.common.util.Layui;
import com.wcgksoft.entity.admin.Account;
import com.wcgksoft.service.admin.AccountService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 御风
 * @version V1.0
 * @Package com.wcgksoft.controller.updatePassWord
 * @Description TODO 修改密码
 * @date 2020/5/29 9:27
 * @ClassName UpdateInfoController
 */
@Controller
@RequestMapping("system/passWord")
public class UpdateInfoController {

    @Autowired
    private AccountService accountService;

    @ResponseBody
    @RequestMapping(value = "updatePassWord")
    public Layui updatePassWord(@RequestParam(value = "passWord",required = false)String passWord){
        Account account =(Account) SecurityUtils.getSubject().getSession().getAttribute("om_user");
        account.setPassWord(passWord);
        accountService.saveMerge(account);
        return Layui.data(0, "修改成功", 1, null);
    }
}
